﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace mitasoft.ERS.Web.Utils
{
    public class SessionWrapper
    {
        public static string SESSION_CurrentProjectID = "SESSION_CurrentProjectID";
        public static string SESSION_CurrentProjectName = "SESSION_CurrentProjectName";

        public static void AddToSession(string key, object data)
        {
            HttpContext.Current.Session[key] = data;
        }
        public static T GetFromSession<T>(string key)
        {
            if (ExistKey(key))
                return (T)HttpContext.Current.Session[key];

            return default(T);
        }

        private static bool ExistKey(string key)
        {
            return HttpContext.Current.Session[key] != null;
        }

    }
}